<template>
	<view class="offer">
		<view class="cell"  >
			<u-cell-group v-if="offer">
				<u-cell  title="教育经历" :value="offer.education"  @click='fixoff'/>
				<u-cell  title="现居住地" :value="offer.address" @click='fixoff'/>
				<u-cell  title="期望薪资" :value="offer.money" @click='fixoff'/>
				<u-cell  title="工作经历" :value="offer.experience" @click='fixoff'/>
				<u-cell class="per"  title="个人简介"  :value="offer.individualResume" @click='fixoff'/>
			</u-cell-group>
		</view>
		<view class="add">
			<up-button type="primary" text="新增简历" @click='gotoadd'></up-button>
		</view>

	</view>
</template>
<script setup>
	import {
		onMounted,
		getCurrentInstance,
		ref,
		nextTick
	} from 'vue'
	import {
		getdeliverlist,
		getoffer
	} from '../../../api/jobApi.js'
	
	import {jianli } from '@/mock/work.js'

	const id = ref() //用户的id
	const offer = ref() //用户的offer

	//跳转到新增简历页面
	const gotoadd = () => {
		uni.navigateTo({
			url: '/pages/job/add/add?id=' + id.value
		})

	}
    
	//点击修改简历
	const fixoff=()=>{
		uni.navigateTo({
			url: `/pages/job/fixoff/fixoff?id=${offer.value.id}&offer=${JSON.stringify(offer.value)}`
		})
	}
	
	//查询用户简历详情
	const getofferlist = async () => {

		id.value = getCurrentInstance().attrs.id

		let res = await getoffer({
			userId: getCurrentInstance().attrs.id,
			header: {
				'Authorization': uni.getStorageSync('token')
			},
			data: {}
		})

		nextTick(() => {
			if (res.code == 200) {

				offer.value = res.data
			}else{
				//模拟数据
				offer.value =jianli()[0]
			}
				
			console.log(offer.value);
		})

	}
	onMounted(() => {
		getofferlist()
	})
</script>

<style lang="scss">
	.offer {
		width: 100%;

		.add {
			margin: 20px 0px;
			padding: 0px 10px;

		}
		
		.per{
			
		::v-deep .u-cell__value{
			flex:3;
			text-align: left;
			
		}
		}
		
		
		
	}
</style>